package com.tenbent.product.center.resource.dto;

import com.tenbent.product.base.dto.BaseDto;
import com.tenbent.product.center.resource.bo.Resource;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * 资源DTO
 *
 * @author Randy
 *
 *         Created by ThinkPad on 2017/9/12.
 */
public class ResourceDto extends BaseDto {

	/** 资源名称 */
	@NotEmpty(message = "{resource.name.not.empty}")
	private String name;

	/** 资源url */
	@NotEmpty(message = "{resource.url.not.empty}")
	private String url;

	/** 描述 */
	private String description;

	public ResourceDto() {

	}

	public ResourceDto(Resource resource) {
		super(resource);
		setName(resource.getName());
		setUrl(resource.getUrl());
		setDescription(resource.getDescription());
	}

	public Resource transToBo() {
		Resource resource = new Resource();
		super.transToBo(resource);
		resource.setName(getName());
		resource.setUrl(getUrl());
		resource.setDescription(getDescription());
		return resource;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
